<template>
  <div>
    <h2>添加部门</h2>
    部门名称<input type="text" v-model="name">
    <button @click="sub">添加</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      'name':''
    }
  },
  methods:{
    sub:function(){
      let formdata=new FormData();
      formdata.append('name',this.name);
      this.axios({
        url:'http://127.0.0.1:8000/app01/deptar/',
        method:'post',
        data:formdata
      }).then(res=>{
        alert(res.data.msg)
      })

    }
  }
}
</script>

<style>

</style>
